mirror of
https://github.com/desktop/desktop
synced 2024-10-31 11:07:25 +00:00
Just pass through the auth state
This commit is contained in:
parent
aa2291b904
commit
369f33a591
2 changed files with 4 additions and 4 deletions
|
@ -36,8 +36,8 @@ export function requestToken(code: string): Promise<string> {
|
||||||
.then(response => response.access_token)
|
.then(response => response.access_token)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOAuthURL(endpoint: string, state: string): string {
|
function getOAuthURL(authState: AuthState): string {
|
||||||
return `${endpoint}/login/oauth/authorize?client_id=${ClientID}&scope=repo&state=${state}`
|
return `${authState.endpoint}/login/oauth/authorize?client_id=${ClientID}&scope=repo&state=${authState.oAuthState}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDotComEndpoint(): string {
|
export function getDotComEndpoint(): string {
|
||||||
|
@ -47,7 +47,7 @@ export function getDotComEndpoint(): string {
|
||||||
export function askUserToAuth(endpoint: string) {
|
export function askUserToAuth(endpoint: string) {
|
||||||
authState = {oAuthState: guid(), endpoint}
|
authState = {oAuthState: guid(), endpoint}
|
||||||
|
|
||||||
shell.openExternal(getOAuthURL(endpoint, authState.oAuthState))
|
shell.openExternal(getOAuthURL(authState))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getToken(username: string): string {
|
export function getToken(username: string): string {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default class User {
|
export default class User {
|
||||||
public token: string
|
public token: string
|
||||||
public login: string
|
public login: string
|
||||||
public server: string
|
public endpoint: string
|
||||||
|
|
||||||
public constructor(login: string, token: string) {
|
public constructor(login: string, token: string) {
|
||||||
this.login = login
|
this.login = login
|
||||||
|
|
Loading…
Reference in a new issue