user_auth; /* ------------------------------------------------------------------------------------ * Goosle - The fast, privacy oriented search tool that just works. * * COPYRIGHT NOTICE * Copyright 2023-2024 Arnan de Gans. All Rights Reserved. * * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT. * By using this code you agree to indemnify Arnan de Gans from any * liability that might arise from its use. ------------------------------------------------------------------------------------ */ ?> Goosle Search oAUTH hash_auth, $opts->hash, $auth)) { ?>

Goosle

Use this page to set up an authorization token for Openverse.
Fill in the relevant fields and click the button at the bottom to continue.

Registration

Email address:

(Always required for verification)

Recovering a previous registration?

Client ID:

Client Secret:

Back to Goosle
user_agents[0].';'), // (array) Headers 'post', // (string) post/get array('name' => 'Goosle Meta Search '.md5(get_base_url($opts->siteurl)), 'description' => 'Goosle Meta Search for '.get_base_url($opts->siteurl), 'email' => $email) // (assoc array) Post body ); $registration = json_decode($registration, true); // Site already exists, get new token if(stristr($registration['name'][0], 'this name already exists')) { if(is_file($token_file)) { $tokens = unserialize(file_get_contents($token_file)); $registration = $tokens['openverse']; } else { echo "
Error - Token file is missing. Please recover your registration with the Client ID and Client Secret.
hash."\">Try again
"; exit; } } } else { $registration = array('client_id' => $client_id, 'client_secret' => $client_secret); } $new_token = do_curl_request( 'https://api.openverse.org/v1/auth_tokens/token/', // (string) Where? array('Accept: application/json, */*;q=0.8', 'User-Agent: '.$opts->user_agents[0].';', 'Authorization: Bearer'.$registration['client_id']), // (array) Headers 'post', // (string) post/get array('grant_type' => 'client_credentials', 'client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret']) // (assoc array) Post body ); $new_token = json_decode($new_token, true); $new_token['expires_in'] = time() + ($new_token['expires_in'] - 3600); oauth_store_token($token_file, $connect, array('client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret'], 'access_token' => $new_token['access_token'], 'expires' => $new_token['expires_in'])); echo "

SUCCESS!

"; echo "

Goosle is now authorized and you can enable Openverse in your config.php!
If this is your first time authorizing with this email address you will receive an email from Openverse in a few minutes with a verification link that you need to click.

"; echo "

To be able to recover your registration save these values:

"; echo "

Used Email Address: ".$email."
Client ID: ".$registration['client_id']."
Client Secret: ".$registration['client_secret']."

hash."&q=goose&t=1\">Continue to Goosle

"; unset($registration, $new_token); } ?>
Goosle"; } ?>