mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-07 20:26:15 +00:00
Change /oauth/token request specs to use client_secret_basic authentication
This commit is contained in:
parent
6463415e06
commit
5a5f1a3718
|
@ -1,21 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'debug'
|
||||
|
||||
RSpec.describe 'Managing OAuth Tokens' do
|
||||
describe 'POST /oauth/token' do
|
||||
subject do
|
||||
post '/oauth/token', params: params
|
||||
post '/oauth/token', params: params, headers: headers
|
||||
end
|
||||
|
||||
let(:application) do
|
||||
Fabricate(:application, scopes: 'read write follow', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob')
|
||||
end
|
||||
|
||||
# This is using the OAuth client_secret_basic client authentication method
|
||||
let(:headers) do
|
||||
{
|
||||
Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(application.uid, application.secret),
|
||||
}
|
||||
end
|
||||
|
||||
let(:params) do
|
||||
{
|
||||
grant_type: grant_type,
|
||||
client_id: application.uid,
|
||||
client_secret: application.secret,
|
||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||
code: code,
|
||||
scope: scope,
|
||||
|
|
Loading…
Reference in New Issue
Block a user