authGoogleCallbackGet
Google OAuth callback
Handles the Google OAuth callback. Exchanges the authorization code for tokens, creates/updates the user, and returns JWT tokens.
/auth/google/callback
Usage and SDK Samples
curl -X GET\
-H "Accept: application/json"\
"http://localhost:8180/auth/google/callback?code=&error="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AuthApi;
import java.io.File;
import java.util.*;
public class AuthApiExample {
public static void main(String[] args) {
AuthApi apiInstance = new AuthApi();
String code = code_example; // String | Authorization code from Google
String error = error_example; // String | Error code if OAuth failed
try {
AuthResponse result = apiInstance.authGoogleCallbackGet(code, error);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthApi#authGoogleCallbackGet");
e.printStackTrace();
}
}
}
import io.swagger.client.api.AuthApi;
public class AuthApiExample {
public static void main(String[] args) {
AuthApi apiInstance = new AuthApi();
String code = code_example; // String | Authorization code from Google
String error = error_example; // String | Error code if OAuth failed
try {
AuthResponse result = apiInstance.authGoogleCallbackGet(code, error);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthApi#authGoogleCallbackGet");
e.printStackTrace();
}
}
}
String *code = code_example; // Authorization code from Google
String *error = error_example; // Error code if OAuth failed (optional)
AuthApi *apiInstance = [[AuthApi alloc] init];
// Google OAuth callback
[apiInstance authGoogleCallbackGetWith:code
error:error
completionHandler: ^(AuthResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var GoPosBackendApi = require('go_pos_backend_api');
var api = new GoPosBackendApi.AuthApi()
var code = code_example; // {{String}} Authorization code from Google
var opts = {
'error': error_example // {{String}} Error code if OAuth failed
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.authGoogleCallbackGet(code, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class authGoogleCallbackGetExample
{
public void main()
{
var apiInstance = new AuthApi();
var code = code_example; // String | Authorization code from Google
var error = error_example; // String | Error code if OAuth failed (optional)
try
{
// Google OAuth callback
AuthResponse result = apiInstance.authGoogleCallbackGet(code, error);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AuthApi.authGoogleCallbackGet: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\ApiAuthApi();
$code = code_example; // String | Authorization code from Google
$error = error_example; // String | Error code if OAuth failed
try {
$result = $api_instance->authGoogleCallbackGet($code, $error);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthApi->authGoogleCallbackGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AuthApi;
my $api_instance = WWW::SwaggerClient::AuthApi->new();
my $code = code_example; # String | Authorization code from Google
my $error = error_example; # String | Error code if OAuth failed
eval {
my $result = $api_instance->authGoogleCallbackGet(code => $code, error => $error);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthApi->authGoogleCallbackGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.AuthApi()
code = code_example # String | Authorization code from Google
error = error_example # String | Error code if OAuth failed (optional)
try:
# Google OAuth callback
api_response = api_instance.auth_google_callback_get(code, error=error)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthApi->authGoogleCallbackGet: %s\n" % e)
Parameters
| Name | Description |
|---|---|
| code* |
String
Authorization code from Google
Required
|
| error |
String
Error code if OAuth failed
|