mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#21: support /oauth2/v1 on frontend
This commit is contained in:
@@ -70,7 +70,7 @@ function stopLoading() {
|
||||
/* global process: false */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// some shortcuts for testing on localhost
|
||||
window.testOAuth = () => location.href = '/oauth?client_id=ely&redirect_uri=http%3A%2F%2Fely.by&response_type=code&scope=minecraft_server_session';
|
||||
window.testOAuthStatic = () => location.href = '/oauth?client_id=ely&redirect_uri=static_page_with_code&response_type=code&scope=minecraft_server_session';
|
||||
window.testOAuthStaticCode = () => location.href = '/oauth?client_id=ely&redirect_uri=static_page&response_type=code&scope=minecraft_server_session';
|
||||
window.testOAuth = () => location.href = '/oauth2/v1?client_id=ely&redirect_uri=http%3A%2F%2Fely.by&response_type=code&scope=minecraft_server_session';
|
||||
window.testOAuthStatic = () => location.href = '/oauth2/v1?client_id=ely&redirect_uri=static_page_with_code&response_type=code&scope=minecraft_server_session';
|
||||
window.testOAuthStaticCode = () => location.href = '/oauth2/v1?client_id=ely&redirect_uri=static_page&response_type=code&scope=minecraft_server_session';
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ export default function routesFactory(store) {
|
||||
|
||||
<Route path="rules" component={RulesPage} />
|
||||
|
||||
<Route path="oauth" component={OAuthInit} {...startAuthFlow} />
|
||||
<Route path="oauth2(/:version)" component={OAuthInit} {...startAuthFlow} />
|
||||
|
||||
<Route path="auth" component={AuthPage}>
|
||||
<Route path="/login" components={new Login()} {...startAuthFlow} />
|
||||
|
@@ -3,7 +3,7 @@ import request from 'services/request';
|
||||
export default {
|
||||
validate(oauthData) {
|
||||
return request.get(
|
||||
'/api/oauth/validate',
|
||||
'/api/oauth2/v1/validate',
|
||||
getOAuthRequest(oauthData)
|
||||
).catch(handleOauthParamsValidation);
|
||||
},
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
const query = request.buildQuery(getOAuthRequest(oauthData));
|
||||
|
||||
return request.post(
|
||||
`/api/oauth/complete?${query}`,
|
||||
`/api/oauth2/v1/complete?${query}`,
|
||||
typeof params.accept === 'undefined' ? {} : {accept: params.accept}
|
||||
).catch((resp = {}) => {
|
||||
if (resp.statusCode === 401 && resp.error === 'access_denied') {
|
||||
|
@@ -122,8 +122,9 @@ export default class AuthFlow {
|
||||
this.run('setOAuthRequest', {});
|
||||
}
|
||||
|
||||
switch (path) { // use only first part of an url
|
||||
case '/oauth':
|
||||
switch (path) {
|
||||
case '/oauth2/v1':
|
||||
case '/oauth2':
|
||||
this.setState(new OAuthState());
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user